package com.bootdo.common.rabbitmqconfig;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 消费者
 */
//@Component
public class AmqpServiceConsumer {


    //@RabbitListener(queues = {"com.queue.notify.hello"})
    public void receiveSmsCodeQueue(String message, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, Channel channel) {
        System.err.println("------hello：消费者处理消息------");
        System.err.println(message);
        try {
            channel.basicAck(deliveryTag,false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
